package com.zhuiyun.educations.api.fileprice.controller;

import com.zhuiyun.educations.api.fileprice.entity.FilePrice;
import com.zhuiyun.educations.api.fileprice.service.FilePriceService;
import com.zhuiyun.educations.common.response.CommonResult;
import com.zhuiyun.educations.util.pageUtil.PageRequest;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import lombok.extern.slf4j.Slf4j;
import org.springframework.web.bind.annotation.*;

import javax.annotation.Resource;

/**
 * @ClassName CoursePriceController
 * @Description TODO 课程价钱
 * @Author ys
 * @Date 2023/6/19 19:47
 **/
@Slf4j
@RestController
@Api(tags = "课程价钱")
@RequestMapping("/filePrice")
public class FilePriceController {

    @Resource
    private FilePriceService filePriceService;
    /**
     * @Author ys
     * @Description TODO 分页查询
     * @Date 2023/6/26 14:09
     * @Return CommonResult
     * @param
     */
    @GetMapping("/getFilePrice")
    @ApiOperation(value = "课程价钱的分页查询方法")
    public CommonResult getFilePrice(PageRequest pageRequest){
        log.info("分页查询");
        return filePriceService.getFilePrice(pageRequest);
    }
    /**
     * @Author ys
     * @Description TODO 新增
     * @Date 2023/6/26 14:09
     * @Return CommonResult
     * @param
     */
    @PostMapping("/addFilePrice")
    @ApiOperation(value = "课程价钱的添加方法")
    public CommonResult addFilePrice(@RequestBody FilePrice filePrice) {
        log.info("添加");
        return filePriceService.addFilePrice(filePrice);
    }
    /**
     * @Author ys
     * @Description TODO 修改
     * @Date 2023/6/26 14:09
     * @Return CommonResult
     * @param
     */
    @PutMapping("/updateFilePrice")
    @ApiOperation(value = "课程价钱的修改方法")
    public CommonResult updateFilePrice(@RequestBody FilePrice filePrice) {
        log.info("修改");
        return filePriceService.updateFilePrice(filePrice);
    }
    /**
     * @Author ys
     * @Description TODO 逻辑删除
     * @Date 2023/6/26 14:09
     * @Return CommonResult
     * @param
     */
    @DeleteMapping("/deleteFilePriceById")
    @ApiOperation(value = "课程价钱的逻辑删除方法")
    public CommonResult deleteFilePriceById(int id) {
        log.info("逻辑删除");
        return filePriceService.deleteFilePriceById(id);
    }
    /**
     * @Author ys
     * @Description TODO 资料动态下拉
     * @Date 2023/6/26 14:09
     * @Return CommonResult
     * @param
     */
    @GetMapping("/fileSelect")
    @ApiOperation(value = "课程资料的资料动态下拉方法")
    public CommonResult fileSelect(){
        log.info("资料动态下拉");
        return filePriceService.fileSelect();
    }
}
